<div class="dialog_content">
    <form id="info_form" action="<if condition="$action_name=='add'">{:U('Wechat/add')}<else />{:U('Wechat/edit')}</if>" method="post">
        <table width="100%" class="table_form">
            <tr>
                <th width="80">{:L('site_name')} :</th>
                <td>
                    <select style="clear:both;position: relative;width: 150px" name="site_id" id="J_site_id">
                        <option value="0">{:L('chose_site')}</option>
                        <volist name="site_list" id="val">
                            <option value="{$val.site_id}" <if condition="$val['site_id'] eq $info['site_id']">selected="selected"</if>>{$val.site_name}</option>
                        </volist>
                    </select>
                </td>
            </tr>
            <tr>
                <th>{:L('app_id')} :</th>
                <td><input type="text" name="app_id" class="input-text" id="J_app_id" value="{$info.app_id}" ></td>
            </tr>
            <tr>
                <th>{:L('app_secret')} :</th>
                <td><input type="text" name="app_secret" id="J_app_secret" value="{$info.app_secret}" class="input-text"></td>
            </tr>
            <tr>
                <th>{:L('token')} :</th>
                <td><input type="text" name="token" id="J_token" value="{$info.token}" class="input-text"></td>
            </tr>
        </table>
        <input type="hidden" name="id" value="{$info.id}" />
    </form>
</div>
<script>
        <volist name=":L('js_wechat')" id="val">
        lang.{$key} = "{$val}";
        </volist>
        $(function(){
            $.formValidator.initConfig({formid:"info_form",autotip:true});
            $("#J_site_id").formValidator({ onshow:lang.site_name, onfocus:lang.site_name}).inputValidator({ min:1, onerror:lang.site_name});
            $("#J_app_id").formValidator({ onshow:lang.app_id, onfocus:lang.app_id}).inputValidator({ min:2, onerror:lang.app_id});
            $("#J_app_secret").formValidator({ onshow:lang.app_secret, onfocus:lang.app_secret}).inputValidator({ min:2, onerror:lang.app_secret});
            $("#J_token").formValidator({ onshow:lang.token, onfocus:lang.token}).inputValidator({ min:2, onerror:lang.token});
            $('#info_form').ajaxForm({success:complate,dataType:'json'});
            function complate(result){
                if(result.status == 1){
                    $.dialog.get(result.dialog).close();
                    $.TP.tip({content:result.msg});
                    window.location.reload();
                } else {
                    $.TP.tip({content:result.msg, icon:'alert'});
                }
            }
        });
</script>